package com.jsmy.softapp.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.jsmy.softapp.fragment.FragmentSmanager;

/**
 * Created with Android Studio.
 * User: wei_cd.
 * Date: 2018/4/17.
 * Time: 18:04.
 * To change for file | settings | file and code templates.
 */

public class SoftFragmentAdapter extends FragmentPagerAdapter {
    private FragmentSmanager smanager;
    public SoftFragmentAdapter(FragmentManager fm) {
        super(fm);
        smanager = FragmentSmanager.getInstance();
    }
    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        switch (position){
            case 0:
                fragment = smanager.getFragment(FragmentSmanager.HOME);
                break;
            case 1:
                fragment = smanager.getFragment(FragmentSmanager.DATA);
                break;
            case 2:
                fragment = smanager.getFragment(FragmentSmanager.BUSINESS);
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return 3;
    }
}
